<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title>订单列表</title>
    <link rel="stylesheet" href="__CSS__/pintuer.css">
    <link rel="stylesheet" href="__CSS__/admin.css">
    <script src="__JS__/jquery.js"></script>
    <script src="__JS__/pintuer.js"></script>
</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
    <div class="padding border-bottom">
        <ul class="search" style="padding-left:10px;">
            <li> <a class="button border-main icon-plus-square-o" href="<{:url('good/good_add')}>"> 添加内容</a> </li>
            <li> <a class="button border-main" href="<{:url('good_list')}>"><span class="icon-edit"></span> 商品列表 </a> </li>

    </div>
    <table class="table table-hover text-center">
        <tr>
            <th width="100" style="text-align:left; padding-left:20px;">ID</th>
            <th width="15%">商品名称</th>
            <th>图片</th>
            <th>价格</th>
            <th>分类名称</th>
            <th>品牌</th>
            <th>上架时间</th>
            <th>推荐</th>
            <th>热门</th>
            <th>上架/下架</th>
            <th width="310">操作</th>
        </tr>

        <{volist name="list" id="vo" empty='$empty'}>
        <tr>
            <td style="text-align:left; padding-left:20px;"><input type="checkbox" class="chk" value="<{$vo['goods_id']}>" /> <{$vo['goods_id']}> </td>
            <td><{:str_replace(input('keywords'),"<font color='red'><b>".input('keywords')."</b></font>",$vo['goods_name'])}></td>
            <td width="10%"><img src="__BRAND__/<{$vo['default_image']}>" alt="" width="70" height="50" onerror="this.src='__IMAGES__/logo.png'"/></td>
            <td> <{$vo['price']}> </td>
            <td> <{$vo['cate_name']}> </td>
            <td>  <{$vo['brand_name']}></td>
            <td> <{$vo['add_time']}> </td>
            <td><font color="#00CC99"> <img style="width: 20px; height: 20px;" src="__IMAGES__/<{$vo['recommended']}>" alt=""> </font></td>
            <td><font color="#00CC99"><img style="width: 20px; height: 20px;" src="__IMAGES__/<{$vo['recom']}>" alt=""></font></td>
            <td><font color="#00CC99"> <img style="width: 20px; height: 20px;" src="__IMAGES__/<{$vo['if_show']}>" alt="">  </font></td>
            <td><div class="button-group"> <a class="button border-main" href="<{:url('recover',['gid'=>$vo['goods_id']])}>"><span class="icon-edit"></span> 恢复数据</a>
                <a class="button border-red del"  a="<{:url('huishoudel',['gid'=>$vo['goods_id']])}>" href="#" onclick="return del(1,1,1)"><span class="icon-trash-o"></span> 永久删除</a> </div></td>
        </tr>
        <{/volist}>

        <td style="text-align:left; padding:19px 0;padding-left:20px;"><input type="checkbox" id="checkall"/>
            全选 </td>
        <td colspan="9" style="text-align:left;padding-left:20px;"><a id="delAll" a="<{:url('del_time',input('get.'))}>" href="#" class="button border-red icon-trash-o" style="padding:5px 15px;" onclick="DelSelect()"> 删除</a>
            <a href="javascript:void(0)" style="padding:5px 15px; margin:0 10px;" class="button border-blue icon-edit" onclick="sorts()"> 排序</a> 操作：
            <select name="ishome" style="padding:5px 15px; border:1px solid #ddd;" onchange="changeishome(this)">
                <option value="">首页</option>
                <option value="1">是</option>
                <option value="0">否</option>
            </select>
            <select name="isvouch" style="padding:5px 15px; border:1px solid #ddd;" onchange="changeisvouch(this)">
                <option value="">推荐</option>
                <option value="1">是</option>
                <option value="0">否</option>
            </select>
            <select name="istop" style="padding:5px 15px; border:1px solid #ddd;" onchange="changeistop(this)">
                <option value="">下架</option>
                <option value="1">是</option>
                <option value="0">否</option>
            </select>
        </td>
        </tr>
        <tr>
            <td colspan="9"><div class="pagelist">
                <{$list|raw}>
            </div></td>
        </tr>
    </table>
</div>
<script src="__JS__/jquery-1.8.3.js"></script>
<!--删除（单删除，软删除）-->
<script>
    $(".del").click(function(){
        var a=$(this).attr("a");
        var bool=confirm("此操作会永久删除数据,是否继续?");
        if(bool){
            console.log(a);
            location.href= a;
        }

    })
</script>
<!--批量删除（软删除）-->
<script>
    $("#delAll").click(function(){
        var arr=[];
        var a = $(this).attr('a');
        $('.chk').each(function(i,o){
            if($(o).prop('checked')){
                arr.push($(o).val());
            }
        });
        if(arr.length>0){
            if(confirm("确认删除吗？")) {
                location.href = a + arr.join(',');
                return false;
            }
        }
        return false;
    });
</script>






<!--<script>-->
<!--$(".a").click(function(){-->
<!--if($(".a").html()=="上架时间"){-->
<!--var a=$(this).attr('a');-->
<!--location.href="good_list.html?id="+a+"";-->
<!--$(".a").html("上架时间↓");-->
<!--}else if($(".a").html()=="上架时间↓"){-->
<!--var a=$(this).attr('a');;-->
<!--location.href="good_list.html?id="+a+"";-->
<!--$(".a").html("上架时间↑");-->
<!--}else if($(".a").html()=="上架时间↑"){-->
<!--var a=$(this).attr('a');;-->
<!--location.href="good_list.html?id="+a+"";-->
<!--$(".a").html("上架时间");-->
<!--}-->
<!--})-->
<!--</script>-->
<script type="text/javascript">
    //搜索
    function changesearch(){

    }


    //全选
    $("#checkall").click(function(){
        $("input[name='id[]']").each(function(){
            if (this.checked) {
                this.checked = false;
            }
            else {
                this.checked = true;
            }
        });
    })


    //批量排序
    function sorts(){
        var Checkbox=false;
        $("input[name='id[]']").each(function(){
            if (this.checked==true) {
                Checkbox=true;
            }
        });
        if (Checkbox){

            $("#listform").submit();
        }
        else{
            alert("请选择要操作的内容!");
            return false;
        }
    }


    //批量首页显示
    function changeishome(o){
        var Checkbox=false;
        $("input[name='id[]']").each(function(){
            if (this.checked==true) {
                Checkbox=true;
            }
        });
        if (Checkbox){

            $("#listform").submit();
        }
        else{
            alert("请选择要操作的内容!");

            return false;
        }
    }

    //批量推荐
    function changeisvouch(o){
        var Checkbox=false;
        $("input[name='id[]']").each(function(){
            if (this.checked==true) {
                Checkbox=true;
            }
        });
        if (Checkbox){


            $("#listform").submit();
        }
        else{
            alert("请选择要操作的内容!");

            return false;
        }
    }

    //批量置顶
    function changeistop(o){
        var Checkbox=false;
        $("input[name='id[]']").each(function(){
            if (this.checked==true) {
                Checkbox=true;
            }
        });
        if (Checkbox){

            $("#listform").submit();
        }
        else{
            alert("请选择要操作的内容!");

            return false;
        }
    }


    //批量移动
    function changecate(o){
        var Checkbox=false;
        $("input[name='id[]']").each(function(){
            if (this.checked==true) {
                Checkbox=true;
            }
        });
        if (Checkbox){

            $("#listform").submit();
        }
        else{
            alert("请选择要操作的内容!");

            return false;
        }
    }

    //批量复制
    function changecopy(o){
        var Checkbox=false;
        $("input[name='id[]']").each(function(){
            if (this.checked==true) {
                Checkbox=true;
            }
        });
        if (Checkbox){
            var i = 0;
            $("input[name='id[]']").each(function(){
                if (this.checked==true) {
                    i++;
                }
            });
            if(i>1){
                alert("只能选择一条信息!");
                $(o).find("option:first").prop("selected","selected");
            }else{

                $("#listform").submit();
            }
        }
        else{
            alert("请选择要复制的内容!");
            $(o).find("option:first").prop("selected","selected");
            return false;
        }
    }

</script>
</body>
</html>